import Vue from "vue";
import Router from "@lib/r_.js";
Vue.use(Router);
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
};

// 权限

import login from "../pages/login/index.vue";
import findback from "../pages/findback/index.vue";
import main from "../pages/main/index.vue";
import dashboard from "../pages/dashboard/index.vue";

import coupon from "../pages/coupon/index.vue";


// import interventionTemplate from "../pages/interventionTemplate/index.vue";
import organization from "../pages/organization/index.vue";
import system_index from "../pages/system/index.vue";
import system_role from "../pages/system/role/index.vue";
import system_account from "../pages/system/account/index.vue";
import system_user from "../pages/system/user/index.vue";
import system_template from "../pages/system/template/index.vue";
import system_typeFollow from "../pages/system/typeFollow/index.vue";
import system_typeIntervention from "../pages/system/typeIntervention/index.vue";
import system_tag from "../pages/system/tag/index.vue";
import system_organ from "../pages/system/organ/index.vue";
import system_employee from "../pages/system/employee/index.vue"

import customer_index from "../pages/customer/index.vue";
import customer_list from "../pages/customer/list/index.vue";
import customer_add from "../pages/customer/add/index.vue";
import customer_history from "../pages/customer/history/index.vue";
import customer_detail from "../pages/customer/detail/index.vue";

import intervention_index from "../pages/intervention/index.vue";
import intervention_list from "../pages/intervention/list/index.vue";
import intervention_history from "../pages/intervention/history/index.vue";

import follow_index from "../pages/follow/index.vue";
import follow_plan from "../pages/follow/plan/index.vue";
import follow_task from "../pages/follow/task/index.vue";
import follow_history from "../pages/follow/history/index.vue";
import follow_cancel from "../pages/follow/cancel/index.vue";


import evaluation_index from "../pages/evaluation/index.vue"
import evaluation_exam from "../pages/evaluation/exam/index.vue"
import evaluation_history from "../pages/evaluation/history/index.vue"

// SGPC
// TNBPC


export default new Router({
    // mode:'history',
    routes: [
        {
            path: "/login",
            component: login,
            meta: { auth: true }
        },
        {
            path: "/findback",
            component: findback,
            meta: { auth: true }
        },
        // findback
        {
            path: "/",
            component: main,
            children: [
                {
                    path: "",
                    component: dashboard, // 权限
                    meta: {name:'首页',icon:'ios-timer-outline'}
                },
                {
                    path: "system",
                    component: system_index,
                    meta: { auth: true,name:'系统管理',icon:'ios-cog-outline'},
                    children: [
                        {
                            path: "organ",
                            component: system_organ,
                            meta: {name:'机构设置'},
                        },
                        {
                            path: "role",
                            component: system_role,
                            meta: {name:'角色管理'},
                        },
                        {
                            path: "account",
                            component: system_account,
                            meta: {name:'账户管理'},
                        },
                        {
                            path: "user",
                            component: system_user,
                            meta: {name:'用户管理'},

                        },
                        {
                            path: "template",
                            component: system_template,
                            meta: {name:'模板管理'},

                        },
                        {
                            path: "typeFollow",
                            component: system_typeFollow,
                            meta: {name:'随访类型'},
                        },
                        {
                            path: "typeIntervention",
                            component: system_typeIntervention,
                            meta: {name:'干预类型'},
                        },
                        {
                            path: "tag",
                            component: system_tag,
                            meta: {name:'标签管理'},
                        },
                        {
                            path: "employee",
                            component: system_employee,
                            meta: {name:'员工管理'},
                        }
                    ]
                },


// import evaluation_SGPC from "../pages/evaluation/SGPC/index.vue"
// import evaluation_TNBPC from "../pages/evaluation/TNBPC/index.vue"


                {
                    path: "evaluation",
                    component: evaluation_index,
                    meta: { auth: true,name:'AI健康评估'},
                    children: [
                        {
                            path: "history",
                            component: evaluation_history,
                            meta: {name:'风险评估记录'},
                        },
                        {
                            path: ":code",
                            component: evaluation_exam,
                            meta: {name:'评测'},
                        },
                    ]
                },
                {
                    path: "customer",
                    component: customer_index,
                    meta: { auth: true,name:'患者管理',icon:'ios-people-outline'},
                    children: [
                        {
                            path: "",
                            component: customer_list,
                            meta: {name:'患者列表'},
                        },
                        {
                            path: "add",
                            component: customer_add,
                            meta: {name:'患者建档'},
                        },
                        {
                            path: "history",
                            component: customer_history,
                            meta: {name:'监测记录',},
                        },
                        {
                            path: "detail",
                            component: customer_detail,
                            meta: {name:'健康档案',},

                        }
                    ]
                },
                {
                    path: "intervention",
                    component: intervention_index,
                    meta: { auth: true ,name:'干预管理', icon:'ios-medkit-outline'},
                    children: [
                        {
                            path: "",
                            component: intervention_list,
                            meta: {name:'健康干预',},
                        },
                        {
                            path: "history",
                            component: intervention_history,
                            meta: {name:'干预记录',},
                        }
                    ]
                },
                {
                    path: "follow",
                    component: follow_index,
                    meta: { auth: true, name:'随访管理',  icon:'ios-paper-outline'},
                    children: [
                        {
                            path: "plan",
                            component: follow_plan,
                            meta: {name:'制定计划',},
                        },
                        {
                            path: "task",
                            component: follow_task,
                            meta: {name:'随访任务',},
                        },
                        {
                            path: "history",
                            component: follow_history,
                            meta: {name:'随访记录',},
                        },
                        {
                            path: "cancel",
                            component: follow_cancel,
                            meta: {name:'取消记录',},
                        },
                    ]
                },
                {
                    path: "coupon",
                    component: coupon,
                    meta: { auth: true, name: '优惠券',icon:'ios-pricetag-outline' }
                },
                {
                    path: "organization",
                    component: organization,
                    meta: { auth: true,name:'关于我们',icon:'ios-link' }
                },
            ]
        }
    ]
});
